<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<!-- v-model.trim:实现数据绑定的时候去除空白格 -->
			<input type="text" v-model.trim="username"><br />
			<input type="button" value="字符串去除空白字段" v-on:click="fun1()"/><br />
			<a v-text="usernameLength"></a>
			
		</div>
		
		
		
		<script src="../js/vuejs-2.5.16.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			const vue  = new Vue({
				el:"#app",
				data:{
					username:"",
					usernameLength:""
				},
				methods:{
					// 获取字符串的长度
					fun1:function(){
						this.usernameLength = this.username.length;
					}
				}
			})
		</script>
		
	</body>
</html>
